<style type="text/css">
	.f-input{height: 30px;}
	.f-input #file_name{
    width: 80%;
    height: 30px;
  }
  
  .f-input a.input {
    width:18%;
    height:30px;
    line-height:30px;
    background:#3091d1;
   text-align:center;
   display:inline-block;/*具有行内元素的视觉，块级元素的属性 宽高*/
   overflow:hidden;/*去掉的话，输入框也可以点击*/
   position:relative;/*相对定位，为 #file 的绝对定位准备*/
   top:10px;
   text-decoration:none;
   color:#FFF;
   margin-bottom:-2px ;
 }
 .f-input a.input:hover {
   background:#31b0d5;
   color: #ffffff;
 }
 .f-input #file {
   opacity:0;/*设置此控件透明度为零，即完全透明*/
   filter:alpha(opacity=0);/*设置此控件透明度为零，即完全透明针对IE*/
   font-size:100px;
   position:absolute;/*绝对定位，相对于 .input */
   top:0;
   right:0;
 }
</style>
<div class="cbody">
	<div class="cwarp">
		<div class="page-content">
			<div class="page-header">
				<h1>
					<a href="#/user/user_list">试题管理</a>
					<small> <i class="ace-icon fa fa-angle-double-right"></i> 试题新增
					</small>
				</h1>
			</div>
			<!-- /.page-header -->
			<div class="row">
				<div class="col-xs-12">
					<form class="form-horizontal" role="form" id="addForm" name="addForm" ng-model="addForm"
						novalidate>
						<div class="form-group">
							<label class="col-xs-3 col-sm-3 control-label no-padding-right"> 题型<span class="red">*</span> </label>
							<div class="col-xs-7 col-sm-7">
								<div class="col-xs-8 col-sm-8">
									<select name="type" ng-model="addItem.type" required class="col-sm-12">
										<option value="">--请选择--</option>
										<option value="单选题">单选题</option>
										<option value="多选题">多选题</option>
										<option value="判断题">判断题</option>
									</select>
									
								</div>
							</div>
							<div class="space-2">
								<i class="ace-icon fa fa-times-circle"
									ng-show="submitted && addForm.type.$invalid"></i>
								<i class="ace-icon fa fa-check-circle green" ng-show="addForm.type.$valid"></i>
								
								<i class="error" ng-show="submitted && addForm.type.$invalid">
									<small class="error" ng-show="addForm.type.$error.required">请选择题型 </small> 
								</i>
							</div>
						</div> 
						<!-- one -->
						<div class="form-group">
							<label class="col-xs-3 col-sm-3 control-label no-padding-right">
								<span class="red">*</span>
								题目
							</label>
							<div class="col-xs-7 col-sm-7">
								<div class="col-xs-8 col-sm-8">
									<textarea name="quest" rows="" cols="" style="width:100%" ng-model="addItem.quest"  required></textarea>
								</div>
								<i class="ace-icon fa fa-times-circle"
									ng-show="submitted && addForm.quest.$invalid"></i>
								<i class="ace-icon fa fa-check-circle green" ng-show="addForm.quest.$valid"></i>
								
								<i class="error" ng-show="submitted && addForm.quest.$invalid">
									<small class="error" ng-show="addForm.quest.$error.required">题目不可为空 </small> 
								</i>
							</div>
							<div class="space-2"></div>
						</div>
						<!-- one -->

						<!-- 角色树 -->
						<div class="form-group" ng-if="addItem.type != '判断题'">
							<label class="col-xs-3 col-sm-3 control-label no-padding-right">
								题目图片
							</label>
							<div class="col-xs-7 col-sm-7">
								<div class="col-xs-8 col-sm-8">
									<div class="f-input">
										<input type="text" id="file_name" readonly="readonly" placeholder="点击选择要上传的图片" * />
							            <a href="javascript:void(0);" class="input">
							                         浏览
							            	<input type="file" id="file" onchange="angular.element(this).scope().getFile('file');">
							            </a>
									</div>
									
									
								</div>
							</div>
							<div class="space-2">
								<i class="ace-icon fa fa-times-circle"
									ng-show="submitted && addForm.type.$invalid"></i>
								<i class="ace-icon fa fa-check-circle green" ng-show="addForm.type.$valid"></i>
								
								<i class="error" ng-show="submitted && addForm.type.$invalid">
									<small class="error" ng-show="addForm.type.$error.required">请选择题型 </small> 
								</i>
							</div>
						</div>
						
						<div class="form-group">
							<label class="col-xs-3 col-sm-3 control-label no-padding-right">考察点 </label>
							<div class="col-xs-7 col-sm-7">
								<div class="col-xs-8 col-sm-8">
									<select ng-model="addItem.tag" style="width:100%;">
										<option value="">--请选择--</option>
										<option ng-repeat="tag in tags" value="{{tag.id}}">{{tag.tag}}</option>
									</select>
								</div>
							</div>
							<div class="space-2"></div>
						</div> 
						<div class="form-group" ng-if="addItem.type == '判断题'">
							<label class="col-xs-3 col-sm-3 control-label no-padding-right">答案 </label>
							<div class="col-xs-7 col-sm-7">
								<div class="col-xs-8 col-sm-8">
									<select name="answer"  ng-model="answer" style="width:100%;">
										<option value="1">正确</option>
										<option value="0">错误</option>
									</select>
								</div>
							</div>
							<div class="space-2"></div>
						</div> 
						
						<div class="form-group" ng-if="addItem.type != '判断题'">
							<label class="col-xs-3 col-sm-3 control-label no-padding-right"><span class="red">*</span>选项 </label>
							<div class="col-xs-7 col-sm-7">
								<div class="col-xs-8 col-sm-8 ">
									<ul id="tasks" class="item-list ui-sortable">
										<li class="item-red clearfix ui-sortable-handle selected">
											<div class="pull-right action-buttons">
												<span id="" class="left">
													题目选项配置
												</span>

												<span class="vbar"></span>
												<a class="green" ng-click="addChoice()" title="添加选项">
													<i class="fa fa-plus-circle bigger-130"></i>
												</a>
											</div>
										</li>
										
										<li class="item-default clearfix ui-sortable-handle" title="选中设置为正确答案" ng-repeat="item in choices">
											<label class="inline">
												<input type="checkbox" id="{{item.inx}}" ng-true-value="'1'" ng-false-value="'0'" ng-model="item.isTrue" title="正确答案" class="ace">
												<span class="lbl"> {{item.inx}}.{{item.content}}</span>
											</label>
											<div class="pull-right action-buttons">
<!-- 												<a href="#" class="blue"> -->
<!-- 													<i class="ace-icon fa fa-pencil bigger-130"></i> -->
<!-- 												</a> -->
												<a class="red" title="删除" ng-click="delChoice($index)">
													<i class="ace-icon fa fa-minus bigger-130"></i>
												</a>
											</div>
										</li>
	
									</ul>
								</div>
							</div>
							
							<div class="space-2"></div>
						</div>
						
						
						
					</form>
				</div>
				<div class="clearfix form-actions">
					<div class="col-md-offset-3 col-md-7">
						<button class="btn btn-info btn-bold" type="button" 
							ng-click="save()">
							<i class="ace-icon fa fa-check bigger-110"></i>
							保存
						</button>
						&nbsp; &nbsp; &nbsp;
						<button class="btn btn-bold" type="reset" ng-click="backToList()">
							<i class="ace-icon fa fa-reply bigger-110"></i>
							返回
						</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<!-- 弹出框 -->
<div class="modal fade" id="choiceAddModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
	<div class="modal-dialog" style="width:400px; margin-top:10%;">
		<div class="modal-content">
			<div class="modal-header">
<!-- 				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> -->
				<h3 class="modal-title" id="myModalLabel">添加选项</h3>
			</div>
			
			<div class="modal-body">
				<div class="row">
					<div class="col-sm-12">
						<div class="widget-box transparent ui-sortable-handle">
							<div class="widget-body">
								<div class="widget-main padding-6 no-padding-left no-padding-right">

									<div class="row">
										<div class="col-sm-4" style="text-align:right;">
											<label style="color:black;"><span class="red">*</span>索引</label>
										</div>
										<div class="col-sm-8">
											<select class="col-sm-12" ng-model = "choice.inx">
												<option value="">--请选择--</option>
												<option  value="A">A</option>
												<option  value="B">B</option>
												<option  value="C">C</option>
												<option  value="D">D</option>
<!-- 												<option  value="E">E</option> -->
<!-- 												<option  value="F">F</option> -->
<!-- 												<option  value="G">G</option> -->
<!-- 												<option  value="H">H</option> -->
<!-- 												<option  value="I">I</option> -->
											</select>
										</div>
									</div>
									<div class="row" style="margin-top:20px;">
										<div class="col-sm-4"  style="text-align:right;">
											<label style="color:black;"><span class="red">*</span>选项内容</label>
										</div>
										<div class="col-sm-8">
											<textarea  class="col-sm-12" ng-model="choice.content"></textarea>
											
										</div>
									</div>
									<div class="row center"  style="margin-top:10px;"><span class="red">{{errorMsg}}</span></div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer center">
        		<button type="button" class="btn btn-info btn-sm"  ng-click="saveChoice()">保存</button>
        		<button type="button" class="btn btn-default btn-sm" data-dismiss="modal" ng-click="closeEvent()">关闭</button>
        		
      		</div>
    	</div>
  	</div>
</div>
